<template>
  <div style="height: 100%">
    <el-row class="tac">
      <el-col :span="4">
        <el-menu
          :default-active="this.$route.path"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
          router
        >
          <el-menu-item-group>
            <el-menu-item index="/info">个人信息</el-menu-item>
            <el-menu-item index="/History">我的订单</el-menu-item>
            <el-menu-item index="/order">我的预约</el-menu-item>
            <el-menu-item index="/house">我的房源</el-menu-item>
            <el-menu-item index="/commodity">我的商品</el-menu-item>

          </el-menu-item-group>
        </el-menu>
      </el-col>
      <el-col :span="20">
        <el-table
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            fixed
            prop="date"
            label="预约日期"
            mid-width="25px">
          </el-table-column>
          <el-table-column
            prop="amount"
            label="商品编号"
            mid-width="25px">
          </el-table-column>
          <el-table-column
            prop="name"
            label="预约人姓名"
            mid-width="25px">
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            mid-width="25px">
            <template>
              <el-button @click="open" type="text" size="small">举报</el-button>
              <el-button @click="dialogFormVisible = true" type="text" size="small">下单</el-button>

              <el-dialog title="下单" :visible.sync="dialogFormVisible" :append-to-body="true">
                <el-form :model="form">
                  <el-form-item label="" :label-width="formLabelWidth">
                    <el-date-picker
                      v-model="value1"
                      type="monthrange"
                      range-separator="至"
                      start-placeholder="租赁开始时间"
                      end-placeholder="租赁结束时间">
                    </el-date-picker>
                  </el-form-item>

                </el-form>
                <div slot="footer" class="dialog-footer">
                  <el-button @click="dialogFormVisible = false">取 消</el-button>
                  <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
                </div>
              </el-dialog>

            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data () {
    return {
      activeName: 'first',
      value1: '',
      value2: '',
      formLabelWidth: '120px',
      dialogFormVisible: false,
      tableData: [
        { date: '2021-04-02', amount: '171250045', name: '合同学', 操作: '取消收藏' },
        { date: '2021-05-17', amount: '171130435', name: '张同学', 操作: '取消收藏' },
        { date: '2021-06-03', amount: '161361558', name: '丁同学', 操作: '取消收藏' }
      ]
    }
  },
  created () {
    this.initChargeHistory()
    this.initSpendHistory()
  },
  methods: {
    open () {
      this.$prompt('请输入举报内容', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        inputPattern: '',
        inputErrorMessage: '邮箱格式不正确'
      }).then(({ value }) => {
        this.$message({
          type: 'success',
          message: '已提交举报信息'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '取消输入'
        })
      })
    },
    getDate (n) {
      var dateTime = new Date()
      dateTime = dateTime.setDate(dateTime.getDate() + n - 1)
      dateTime = new Date(dateTime)
      return dateTime.toLocaleDateString()
    }
  }

}
</script>

<style scoped>

</style>
